<?php
/*
  This page doesn't do much other than show the is-regulated status of the parcel.
*/
?>

<?php
  if (!isset($_COOKIE['ys-parcelNum'])) {
    setcookie('noParcelNum',true);
    $u = explode('/',$_SERVER['REQUEST_URI']);
    array_pop($u);
    $u = 'http://'.$_SERVER['SERVER_NAME'].implode('/',$u).'/?page=introLocation';
    header('Location: '.$u);
  }
  $isRegistered = isset($_SESSION['gdusername']) AND isset($_SESSION['gdpassword']);

  $thumbnail = 'img/blank.png';
  if (isset($_COOKIE['ys-parcelThumbnail'])) {
    $thumbnail = substr($_COOKIE['ys-parcelThumbnail'],2);
  }

  include_once('util.php');
  $glossary = buildGlossary('Regulated');
?>
<body>

    <div id="site">
<?php include_once('header.php')?>
        <div id="content">

            <div class="home-screen clearfix">

                <div class="left-column" style="width: 500px;">
<?php
  if (substr($_COOKIE['ys-parcelRegulated'],2) == 'True') {
?>
                    <h2 style="margin-bottom: 20px;">The site you selected is regulated.</h2>
                                <p>Under the EPA designated discharge permit for the Charles River watershed, privately-owned sites with two acres or more of connected <?php echo $glossary['impervious']['a']?> surfaces are required to meet a 65% pollution reduction. These sites are considered <strong><?php echo $glossary['regulated']['a']?></strong> sites.<?php echo $glossary['impervious']['div']?><?php echo $glossary['regulated']['div']?></p>
                                <p>The selected parcel is regulated because it's total connected impervious surfaces totals <?php echo sprintf("%.2f",substr($_COOKIE['ys-parcelImperv_Area_(ac)'],2))?> acres, exceeding the minimum for a regulated parcel. Under the EPA designated discharge permit, you are required to decrease your <?php echo $glossary['phosphorous']['a']?> pollution load by 65%.<?php echo $glossary['phosphorous']['div']?></p>
                                <p>Exchange will offer recommendations on reducing pollution from a property. The following pages will help you choose a design option, and allow you to consider the option of buying or selling credits.</p>
                                <p>Click Next to see design recommendations for the selected site.</p>
<?php
  }
  else {
?>
                    <h2 style="margin-bottom: 20px;">The site you selected is not regulated.</h2>
                                <p>Exchange still recommends exploring options for pollution reduction for this parcel. Reducing <?php echo $glossary['phosphorous']['a']?> pollution above required reductions will result in positive credits and will allow property owners to trade credits.<?php echo $glossary['phosphorous']['div']?></p>
                                <p>Under the EPA designated discharge permit for the Charles River watershed, privately-owned sites with two acres or more of connected <?php echo $glossary['impervious']['a']?> surfaces are required to meet a 65% pollution reduction. These sites are considered <strong><?php echo $glossary['regulated']['a']?></strong> sites.<?php echo $glossary['impervious']['div']?><?php echo $glossary['regulated']['div']?></p>
                                <p>Click Next to see design recommendations for the selected site.</p>
<?php
  }
?>
                        </div>
                        <div class="right-column">
                    <table id="blue-box">
                      <tr><th><div id="step-two" class="progress-bar">&nbsp;</div></th></tr>
                      <tr><td>
                        <div id="small_map"><img src="<?php echo $thumbnail?>"></div>
<?php
  if ($isRegistered) {
?>
                        <p><label class="item first">Property Owner:</label><label><?php echo substr($_COOKIE['ys-parcelOwner_Name'],2)?></label></p>
<?php
}
else {
?>
                        <p><label class="item first">Property Address:</label><label><?php echo substr($_COOKIE['ys-parcelPhys_Addr1'],2).', '.substr($_COOKIE['ys-parcelPhys_City'],2)?></label></p>
<?php
}
?>
                        <p>
                          <label class="item">Area (Acres)</label><br>
                          <label class="item">Total:</label><label><?php echo sprintf("%.2f",substr($_COOKIE['ys-parcelTotal_Area_(ac)'],2))?></label><br>
                          <label class="item">Impervious:</label><label><?php echo sprintf("%.2f",substr($_COOKIE['ys-parcelImperv_Area_(ac)'],2))?></label>
                        </p>
                      </td></tr>
                    </table>
                    <p style="text-align: center; margin-top: 10px; margin-left: 40px; width: 240px;"><a class="info" id="designated discharge" href="#">Learn about the designated discharge permit and related site definition</a></p>
                        </div>
                        <div style="clear: both;">
                                <a href="?page=introLocation"><img src="images/back_but.png" style="vertical-align: top; margin-top: 20px;" alt="Back" title="Back" /></a>
                                                                                <a href="?page=introStormwater"><img src="images/next_but.png" style="vertical-align: top; margin-left: 570px; margin-top: 20px;" alt="Next" title="Next" /></a>
                                                                        </div>

            </div>



        </div>
<?php include_once('footer.php')?>
    </div>
<script type="text/javascript">
<?php
  foreach ($glossary as $k => $v) {
    $tNoSpace = str_replace(' ','',$k);
    echo '$(\'a#glossary_t_'.$tNoSpace.'\').click(function(e){e.preventDefault();}).hover(function(e){$(\'#glossary_d_'.$tNoSpace.'\').show();}, function(e){$(\'#glossary_d_'.$tNoSpace.'\').hide();});'."\n";
  }
?>
</script>
  <script type="text/javascript">
    $('a#wq').click(function(e){e.preventDefault();}).hover(function(e){$('#waterQuality').show();}, function(e){$('#waterQuality').hide();})
  </script>
    <script type="text/javascript">
      $(document).ready(function(){
        var clickHereLinks = initClickHereLinks('introRegulated');
        infoWindow = $('table#info-window');
        $('a.info').click(function(e){
          e.preventDefault();
          $('table#info-window tr:eq(1) td:first').html(clickHereLinks[$(this).attr('id')]);
          infoWindow.show()
        });
        $('table#info-window tr td a').click(function(e){
          e.preventDefault();
          infoWindow.hide();
        });
        $('body').live('keydown', function (e) {
            if (infoWindow.css('display') != 'none'){
                var charCode = e.charCode || e.keyCode;
                if (charCode == 27)
                    infoWindow.css('display', 'none');
            }
        });
      });
    </script>
    <table id="info-window">
      <tr><td style="margin:0;padding:4px 7px 0 0;text-align:right;font-size: 16px;font-weight:bold;"><a href="" style="text-decoration:none;">X</a></td></tr>
      <tr><td style="padding-top:0;"></td></tr>
      <tr><td style="text-align: center; padding: 0;"><a href="">close</a></td></tr>
    </table>
</body>
